package com.sas.hnn;

import android.util.Log;

public class Person implements Comparable<Person>{
	
	/**
	 * @uml.property  name="tAG"
	 */
	private String TAG=Person.class.getSimpleName();
	
	/**
	 * @uml.property  name="name"
	 */
	private String name;

	/**
	 * @uml.property  name="street"
	 */
	private String street;

	/**
	 * @uml.property  name="locale"
	 */
	private String locale;
	/**
	 * @uml.property  name="age"
	 */
	private int age;
	/**
	 * @return
	 * @uml.property  name="name"
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name
	 * @uml.property  name="name"
	 */
	public void setName(String name) {
		this.name = name;
	}
	public Person(String name, String age, String street, String locale) {
		super();
		this.name = name;
		this.street = street;
		this.locale = locale;
		this.age= Integer.parseInt(age);
	}
	
	/**
	 * @return
	 * @uml.property  name="street"
	 */
	public String getStreet() {
		return street;
	}
	/**
	 * @param street
	 * @uml.property  name="street"
	 */
	public void setStreet(String street) {
		this.street = street;
	}
	/**
	 * @return
	 * @uml.property  name="locale"
	 */
	public String getLocale() {
		return locale;
	}
	/**
	 * @param locale
	 * @uml.property  name="locale"
	 */
	public void setLocale(String locale) {
		this.locale = locale;
	}
	/**
	 * @return
	 * @uml.property  name="age"
	 */
	public int getAge() {
		return age;
	}
	public String getStringAge() {
		return String.valueOf(age);
	}
	/**
	 * @param age
	 * @uml.property  name="age"
	 */
	public void setAge(int age) {
		this.age = age;
	}
	public int compareTo(Person another) {
		Log.d(TAG,"was"+Persons.sortWhat);
		if(Persons.sortWhat.equals("name"))
				return name.compareTo(another.name);
		if(Persons.sortWhat.equals("street"))
			return street.compareTo(another.street);
		if(Persons.sortWhat.equals("locale"))
			return locale.compareTo(another.locale);
		if(Persons.sortWhat.equals("age"))
			return another.getAge()-age;
		
		return 0;
	}

}
